home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / wpjv1n2.zip / HAXTON.ZIP / TESTLIB.C < prev    next >
C/C++ Source or Header  |  1993-01-28  |  2KB  |  95 lines

  1. //************************************************************************
  2. //*
  3. //* testlib.c
  4. //*
  5. //************************************************************************
  6.  
  7. #define    NOCOMM
  8. #define    _WINDOWS
  9. #define    _WINDLL
  10.  
  11. #include <windows.h>
  12. #include <string.h>
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include "dlls.h"
  16.  
  17. int FAR PASCAL LibMain(HANDLE hInstance, WORD wDataSeg, WORD wHeapSize,
  18.                                 LPSTR lpszCmdLine)
  19. {
  20.  
  21.     if(wHeapSize != 0)
  22.         UnlockData(0);
  23.  
  24.     return(1);
  25.  
  26. } /* LibMain */
  27.  
  28. //*************************************************************************>
  29.  
  30. int FAR PASCAL WEP(int doNothing)
  31. {
  32.     return(1);
  33.  
  34. }    /* WEP */
  35.  
  36.  
  37. //*************************************************************************>
  38.  
  39. BOOL FAR PASCAL StepOne(HWND hWnd)
  40. {
  41.     /* local variables */
  42.     static char    string[20], string2[20];
  43.     short num1, num2;
  44.  
  45.     MessageBox(hWnd, "In StepOne routine!", "StepOne", MB_OK);
  46.  
  47.     num1= 10;
  48.     num2= 20;
  49.  
  50.     /* demonstrates how to pass these variables as far pointers */
  51.     /* if not passed as far pointers, you get bogus data */
  52.     testVars(hWnd, (short far *) &num1, ( short far *) &num2);
  53.  
  54.     /* demonstrates Standard C routines inside a DLL */
  55.     /* notice the variables have been declared static */
  56.     /* thus, they are in the DLLs DS */
  57.  
  58.     itoa(num1, string, 10);
  59.     strcpy(string2, "num1= ");
  60.     strcat(string2, string);
  61.     MessageBox(hWnd, string, "StepOne", MB_OK);
  62.  
  63.     return(TRUE);
  64.  
  65. }    /* StepOne */
  66.  
  67. //*************************************************************************>
  68.  
  69. BOOL FAR PASCAL StepTwo(HWND hWnd)
  70. {
  71.     /* local variables */
  72.     char    testStr2[20];
  73.     static char    testStr[30];
  74.     static short num1, num2;
  75.  
  76.     strcpy(testStr, "In StepTwo routine!");
  77.     MessageBox(hWnd, testStr, "StepTwo", MB_OK);
  78.  
  79.     testStr2[0]= 'T';
  80.     testStr2[1]= 'e';
  81.     testStr2[2]= 's';
  82.     testStr2[3]= 't';
  83.     testStr2[4]= '\0';
  84.  
  85.     testRoutine(hWnd, (char far *) testStr2);
  86.  
  87.     num1= 20;
  88.     num2= 30;
  89.     testVars(hWnd, (short far *) &num1, ( short far *) &num2);
  90.  
  91.     return(TRUE);
  92.  
  93. }    /* StepTwo */
  94.  
  95.